package com.example.rbacmanage.service.app.impl;

import com.example.rbacmanage.entity.app.Message;
import com.example.rbacmanage.mapper.app.MessageMapper;
import com.example.rbacmanage.service.app.MessageService;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class MessageServiceImpl implements MessageService {
    @Autowired
    private MessageMapper messageMapper;
    @Override
    public void save(Message message) {
        messageMapper.insert(message);
    }

    @Override
    public void remove(Long[] ids) {
        for (Long id : ids) {
            messageMapper.del(id);
        }
    }

    @Override
    public void update(Message message) {
        messageMapper.update(message);
    }

    @Override
    public List<Message> getAll(Message message) {
        return messageMapper.list(message);
    }

    @Override
    public PageInfo<Message> getPage(Message message) {
        return new PageInfo<>(getAll(message));
    }

    @Override
    public Message getById(Long id) {
        return messageMapper.queryOneById(id);
    }

    @Override
    public Integer getCount(Message message) {
        return messageMapper.count(message);
    }
}
